#!/bin/bash
etharray=(`ifconfig |grep flags=|grep -v -E "^tap|^qv|^lo|^br"|tr : " "|awk '{print $1}'|sort|uniq   2>/dev/null`)
length=${#etharray[@]}
printf "{\n"
printf  '\t'"\"data\":["
for ((i=0;i<$length;i++))
do
        printf '\n\t\t{'
        printf "\"{#ETH_NAME}\":\"${etharray[$i]}\"}"
        if [ $i -lt $[$length-1] ];then
                printf ','
        fi
done
printf  "\n\t]\n"
printf "}\n"
